<template>
	<view class="cash_page">
		<view class="cash_all">
			<view class="">
				账户余额:
				
			</view>
			<view class="">
				{{yuer}}
			</view>
		</view>
		
		
		
		<view class="cash_item">
			<view class="">
				提现金额:
			</view>
			<input v-model="txMoney" style="width: 300rpx;margin:0 auto;height: 50rpx;" type="text" placeholder="请输入要提现的金额" />
			
		</view>
		<view class="cash_item">
			<view class="">
				银行卡号:
			</view>
			<input v-model="bank_account" style="width: 300rpx;margin:0 auto;height: 50rpx;" type="text" placeholder="请输入银行卡号" />
			
		</view>
		<view class="cash_item">
			<view class="">
				银行名称:
			</view>
			<input v-model="bank_name"  style="width: 300rpx;margin:0 auto;height: 50rpx;" type="text" placeholder="请输入银行名称" />
			
		</view>
		<view class="cash_item">
			<view class="">
				支行名称:
			</view>
			<input v-model="bank_address"   style="width: 300rpx;margin:0 auto;height: 50rpx;" type="text" placeholder="例如长江路支行" />
			
		</view>
		<view class="cash_item">
			<view class="">
				真实姓名:
			</view>
			<input v-model="real_name" style="width: 300rpx;margin:0 auto;height: 50rpx;" type="text" placeholder="请输入真实姓名" />
			
		</view>
		
		<view class="" style="margin-top: 50rpx;">
			
			<view class="cash_btn">
				<button style="background-color: orange;width: 95%;border-radius: 30rpx;" @click="yesMoney">提现</button>
			</view>
		</view>
		
		
		
	</view>
</template>

<script>
	export default {
		onShow() {
			this.yuer = uni.getStorageSync('balance')
		},
		data(){
			return{
				MoneyShows:false,
				txMoney:'',
				bank_account:'',
				bank_name:'',
				bank_address:'',
				real_name:'',
				balance:'',
				yuer:'',
				
				
				
			}
		},
		methods:{
			getUserInfo(){
				this.$req('GET',this.$api.getUser,{
					id:uni.getStorageSync('userId')
				}).then(ress =>{
					
					this.balance = ress.data.store.balance
					
					uni.setStorageSync('balance',this.balance)
					this.yuer = uni.getStorageSync('balance')
				})
			},
			goTx(){
				// moneyTi
				// this.MoneyShows = true
			},
			noMoney(){
				this.MoneyShows = false
			},
			yesMoney(){
				this.$req('POST',this.$api.moneyTi,{
					user_id:uni.getStorageSync('userId'),
					store_id:uni.getStorageSync('storId'),
					amount:this.txMoney,
					bank_name:this.bank_name,
					bank_account:this.bank_account,
					bank_address:this.bank_address,
					real_name:this.real_name
					
					
				}).then(res =>{
					console.log(res,'查看提醒成功与否')
					if(res.status == 200){
						uni.$u.toast('提现申请成功')
						this.getUserInfo()
						this.txMoney = ''
						this.bank_name = ''
						this.bank_account = ''
						this.bank_address = ''
						this.real_name = ''
						this.MoneyShows = false
						
					}else{
						uni.$u.toast(res.message)
						this.txMoney = ''
						this.bank_name = ''
						this.bank_account = ''
						this.bank_address = ''
						this.real_name = ''
						this.MoneyShows = false
					}
					
				}) 
			}
			
			
		}
	}
	
</script>

<style>
	page {
		background: #f6f5f7;
	}
	.cash_page {
		background: #fff;
		border-radius: 8rpx;
		margin: 20rpx;
		padding-bottom: 25rpx;
	}
	.cash_all {
		display: flex;
		padding: 20rpx;
		border-bottom: 1px solid #f4f4f4;
	}
	.cash_item {
		padding-left: 20rpx;
		margin-top: 50rpx;
		display: flex;
		align-items: center;
	}
	
</style>